home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 5487 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.4 KB  |  62 lines

  1. Newsgroups: comp.lang.c
  2. Path: news.sprintlink.net!eskimo!scs
  3. From: scs@eskimo.com (Steve Summit)
  4. Subject: Re: *-* Help Array 640x480 *-*
  5. X-Nntp-Posting-Host: eskimo.com
  6. Message-ID: <DMItxy.Cy9@eskimo.com>
  7. Sender: news@eskimo.com (News User Id)
  8. Organization: schmorganization
  9. References: <4fb7ft$cqa@acmez.gatech.edu>
  10. Date: Fri, 9 Feb 1996 18:27:33 GMT
  11.  
  12. In article <4fb7ft$cqa@acmez.gatech.edu>, gt5512b@prism.gatech.edu
  13. (Israel Denis Jr.) writes:
  14. > I am trying to write some code for image processing 
  15. > using a PC (dos)...  I am running into some problems with borlandc
  16. > not letting me create arrays that are this big...
  17. > I know that this could be implemented with pointers 
  18. > but I need to do this specifically with an array. 
  19.  
  20. If it simply has to be a true array, you may be out of luck, and
  21. it can be tricky to get large amounts of contiguous memory at all
  22. on that benighted platform.
  23.  
  24. Here's what the comp.lang.c FAQ list has to say:
  25.  
  26. 19.23:    How can I allocate arrays or structures bigger than 64K?
  27.  
  28. A:    A reasonable computer ought to give you transparent access to
  29.     all available memory.  If you're not so lucky, you'll either
  30.     have to rethink your program's use of memory, or use various
  31.     system-specific techniques.
  32.  
  33.     64K is (still) a pretty big chunk of memory.  No matter how much
  34.     memory your computer has available, it's asking a lot to be able
  35.     to allocate huge amounts of it contiguously.  (The C Standard
  36.     does not guarantee that a single object can be larger than 32K.)
  37.     Often it's a good idea to use data structures which don't
  38.     require that all memory be contiguous.  For dynamically-
  39.     allocated multidimensional arrays, you can use pointers to
  40.     pointers, as illustrated in question 6.16.  Instead of a large
  41.     array of structures, you can use a linked list, or an array of
  42.     pointers to structures.
  43.  
  44.     If you're using a PC-compatible (8086-based) system, and running
  45.     up against a 640K limit, consider using "huge" memory model, or
  46.     expanded or extended memory, or malloc variants such as halloc()
  47.     or farmalloc(), or a 32-bit "flat" compiler (e.g. djgpp, see
  48.     question 18.3), or some kind of a DOS extender, or another
  49.     operating system.
  50.  
  51.     References: ANSI Sec. 2.2.4.1; ISO Sec. 5.2.4.1.
  52.  
  53.                         Steve Summit
  54.                         scs@eskimo.com
  55. -- 
  56.  
  57. The Communications Decency Act within the Telecommunications Act
  58. of 1996 (U.S.) is an annoying, threatening, abusive, indecent,
  59. and obscene piece of legislation which attempts to ban annoying,
  60. threatening, abusive, indecent, or obscene communication.
  61.